<?php
// 连接数据库
$link = mysqli_connect("localhost","root","root","2108");
if(!$link){
    die("连接数据库失败");
}

// 获取购物车中所有景点的id  1,2,3,4
$ids = $_GET["ids"];
// echo json_encode($ids);

// $sql=`select * from only-details where id in($ids)`;
$sql="SELECT * FROM `only-details` WHERE id IN($ids)";

$res = mysqli_query($link,$sql);

$arr = [];
while($row = mysqli_fetch_assoc($res)){
    $arr[] = $row;
}
echo json_encode([
    "meta"=>[
        "status"=>1,
        "msg"=>"数据获取成功"
    ],
    "data"=>$arr
]);


/* 
    sql 语句中的where条件
    select * from user where name in('leon','leo','jack','tom');
        查询到user表中名字是'leon','leo','jack','tom'中的所有数据
*/